import datetime

from exts import db


class PourType:
    # 正常
    NORMAL = 1
    # 申诉中
    APPEAL = 2
    # 申诉失败
    APPEALLOW = 3
    # 申诉成功
    APPEALTRUE = 4


class TrueFlase:
    WIN = 1  # 赢
    LOW = 2  # 输


class Pour(db.Model):
    __tablename__ = 'pour'

    id = db.Column(db.Integer, autoincrement=True, unique=True, primary_key=True)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))  # 用户id
    agree_id = db.Column(db.Integer, db.ForeignKey('agreement.id'))  # 合约id
    money = db.Column(db.Integer, nullable=False)  # 下注金额
    pour_type = db.Column(db.Integer, default=PourType.NORMAL)  # 申诉类型
    # 输或者赢 逻辑传参
    win_and_lowdb = db.Column(db.Integer, nullable=False, default=TrueFlase.WIN)
    add_time = db.Column(db.DateTime, default=datetime.datetime.now())

    def __int__(self):
        return self.id
